﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using VietApps.TouristManagement.AppCode;


namespace VietApps.TouristManagement
{
    public partial class frmRoles : Form
    {
        //DataTable tblTmp = new DataTable();
        //BLL.PermissionGroups BLLPermissionGroups;
        //Int32 ID = 0;
        //Boolean blnIsUpdate = false;

        public frmRoles()
        {
            InitializeComponent();
            //BLLPermissionGroups = new BLL.PermissionGroups();
        }

        //void loadPermissionGroup()
        //{
        //    dgv.AutoGenerateColumns = false;
        //    dgv.DataSource = BLLPermissionGroups.load();
        //}

        //private void frmPermissions_Load(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        //  cmbPermission.DataSource = Readers.readTXTFile(AppResources.AppData.Permission)
        //        loadPermissionGroup();
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message, AppResources.MsgTitle.erro, MessageBoxButtons.OK, MessageBoxIcon.Error);
        //    }
        //}

        //private void btnSave_Click(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        if (txtPermission.Text == string.Empty)
        //            MessageBox.Show("Vui lòng nhập tên nhóm", AppResources.MsgTitle.infomation, MessageBoxButtons.OK, MessageBoxIcon.Information);
        //        else
        //        {
        //            if (blnIsUpdate)
        //            {
        //                if (BLLPermissionGroups.upd(txtPermission.Text, ID) > 0)
        //                {
        //                    blnIsUpdate = false;
        //                    txtPermission.Text = String.Empty;
        //                    MessageBox.Show(AppResources.MsgContent.saveSuccess, AppResources.MsgTitle.infomation, MessageBoxButtons.OK, MessageBoxIcon.Information);
        //                }
        //                else
        //                    MessageBox.Show(AppResources.MsgContent.saveFail, AppResources.MsgTitle.infomation, MessageBoxButtons.OK, MessageBoxIcon.Information);
        //            }
        //            else
        //            {
        //                if (BLLPermissionGroups.ins(txtPermission.Text) > 0)
        //                {
        //                    txtPermission.Text = String.Empty;
        //                    MessageBox.Show(AppResources.MsgContent.saveSuccess, AppResources.MsgTitle.infomation, MessageBoxButtons.OK, MessageBoxIcon.Information);
        //                }
        //                else
        //                    MessageBox.Show(AppResources.MsgContent.saveFail, AppResources.MsgTitle.infomation, MessageBoxButtons.OK, MessageBoxIcon.Information);
        //            }
        //            loadPermissionGroup();
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message, AppResources.MsgTitle.erro, MessageBoxButtons.OK, MessageBoxIcon.Error);
        //    }
        //}

        //private void btnDel_Click(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        if (ID > 0)
        //        {
        //            if (BLLPermissionGroups.del(ID) > 0)
        //            {
        //                blnIsUpdate = false;
        //                txtPermission.Text = String.Empty;
        //                MessageBox.Show(AppResources.MsgContent.delSuccess, AppResources.MsgTitle.erro, MessageBoxButtons.OK, MessageBoxIcon.Error);
        //                loadPermissionGroup();
        //            }
        //            else
        //                MessageBox.Show(AppResources.MsgContent.delFail, AppResources.MsgTitle.erro, MessageBoxButtons.OK, MessageBoxIcon.Error);
        //        }
        //        else
        //        {
        //            MessageBox.Show(AppResources.MsgContent.selectToDel, AppResources.MsgTitle.erro, MessageBoxButtons.OK, MessageBoxIcon.Error);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message, AppResources.MsgTitle.erro, MessageBoxButtons.OK, MessageBoxIcon.Error);
        //    }
        //}

        //private void btnClose_Click(object sender, EventArgs e)
        //{
        //    this.Close();
        //}

        //private void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        //{
        //    try
        //    {
        //        DataGridViewRow dRw = dgv.Rows[e.RowIndex];
        //        ID = Int32.Parse(dRw.Cells[0].Value.ToString());
        //        txtPermission.Text = dRw.Cells[1].Value.ToString();
        //        blnIsUpdate = true;
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message, AppResources.MsgTitle.erro, MessageBoxButtons.OK, MessageBoxIcon.Error);
        //    }
        //}


    }
}
